import * as cors from 'kcors'
import * as Koa from 'koa'
import * as bodyparser from 'koa-bodyparser'
import * as json from 'koa-json'
import * as logger from 'koa-logger'
import * as onerror from 'koa-onerror'
import { js } from './routes/js'
import { ts } from './routes/ts'

const app = onerror(new Koa())

app.use(cors({ credentials: true }))
app.use(bodyparser())
app.use(json())
app.use(logger())

app.use(...ts)
app.use(...js)

app.listen(3000)

console.log('Server listen on 3000')